﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Stores;

namespace PMS.Data.EntityMap.Stores
{
    /// <summary>
    /// Represents a store mapping configuration
    /// </summary>
    public partial class StoreMappingMap : PMSEntityTypeConfiguration<StoreMapping>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<StoreMapping> builder)
        {
            builder.ToTable("bus_storemapping");
            builder.HasKey(mapping => mapping.Id);

            builder.Property(mapping => mapping.EntityName).HasMaxLength(200).IsRequired();
            builder.Property(mapping => mapping.EntityId).IsRequired();
            builder.Property(mapping => mapping.StoreId).IsRequired();

            builder.Ignore(mapping => mapping.IsActive);
            builder.Ignore(mapping => mapping.CreatedOnTimeUtc);
            builder.Ignore(mapping => mapping.UpdatedOnTimeUtc);
            base.Configure(builder);
        }

        #endregion
    }
}
